gmx -quiet editconf -f complex.pdb -o CBz-HCD_1.gro -box 5.27 5.27 5.27
gmx -quiet solvate -cp CBz-HCD_1.gro -o CBz-HCD_1.gro -p CBz-HCD_1.top
gmx -quiet grompp -f em.mdp -po CBz-HCD_1_em.mdp -c CBz-HCD_1.gro -p CBz-HCD_1.top -o CBz-HCD_1_em.tpr -maxwarn 1
gmx -quiet mdrun -deffnm CBz-HCD_1_em
echo q | gmx -quiet make_ndx -f CBz-HCD_1.gro -o CBz-HCD_1_index.ndx
gmx -quiet grompp -f nvt.mdp -po CBz-HCD_1_nvt.mdp -c CBz-HCD_1_em.gro -r CBz-HCD_1_em.gro -p CBz-HCD_1.top -o CBz-HCD_1_nvt.tpr -n CBz-HCD_1_index.ndx
gmx -quiet mdrun -deffnm CBz-HCD_1_nvt
gmx -quiet grompp -f npt.mdp -po CBz-HCD_1_npt.mdp -c CBz-HCD_1_nvt.gro -t CBz-HCD_1_nvt.cpt -r CBz-HCD_1_nvt.gro -p CBz-HCD_1.top -o CBz-HCD_1_npt.tpr -n CBz-HCD_1_index.ndx
gmx -quiet mdrun -deffnm CBz-HCD_1_npt
gmx -quiet grompp -f md.mdp -po CBz-HCD_1_md.mdp -c CBz-HCD_1_npt.gro -t CBz-HCD_1_npt.cpt -p CBz-HCD_1.top -o CBz-HCD_1_md.tpr -n CBz-HCD_1_index.ndx

gmx -quiet mdrun -deffnm CBz-HCD_1_md
for n in $(seq 2 10)
do
gmx -quiet convert-tpr -s CBz-HCD_1_md.tpr -extend 10000 -o CBz-HCD_1_md.tpr
gmx -quiet mdrun -deffnm CBz-HCD_1_md -cpi CBz-HCD_1_md.cpt
done

echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md.xtc -o CBz-HCD_1_md_c.xtc -center -pbc mol -n CBz-HCD_1_index.ndx -ur compact
echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md_c.xtc -o CBz-HCD_1_md_fit.xtc -n CBz-HCD_1_index.ndx -fit rot+trans
echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md.gro -o CBz-HCD_1_md_f.gro -center -pbc mol -n CBz-HCD_1_index.ndx -ur compact
echo -e "1\n 1\n" | gmx -quiet rms -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md_fit.xtc -n CBz-HCD_1_index.ndx -o rmsd.xvg -m rmsd.xpm
echo -e "1\n 1\n" | gmx -quiet cluster -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md_fit.xtc -n CBz-HCD_1_index.ndx -dm rmsd.xpm -om rmsd-raw.xpm -o rmsd-clust.xpm -g cluster.log -clid clusters.xvg -cl clusters.pdb -cutoff 0.11
echo -e "2\n 3\n" | gmx -quiet hbond -s CBz-HCD_1_md.tpr -f CBz-HCD_1_md_fit.xtc -n CBz-HCD_1_index.ndx -num hbnum.xvg -hbm hbmap.xpm -hbn hbond.ndx
gmx_MMPBSA -nogui -i mmpbsa.in -cs CBz-HCD_1_md.tpr -ci CBz-HCD_1_index.ndx -cg 2 3 -ct CBz-HCD_1_md_fit.xtc -cp CBz-HCD_1.top -o CBz-HCD_1_GBSA.dat -eo CBz-HCD_1_GBSA.csv